using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using FreeSql.DataAnnotations;

namespace Frame.Core.Models {

	[JsonObject(MemberSerialization.OptIn), Table(DisableSyncStructure = true)]
	public partial class Users {

		/// <summary>
		/// ID
		/// </summary>
		[JsonProperty, Column(IsPrimary = true, IsIdentity = true)]
		public int ID { get; set; }

		/// <summary>
		/// 部门ID
		/// </summary>
		[JsonProperty]
		public int? DeptID { get => _DeptID; set {
			if (_DeptID == value) return;
			_DeptID = value;
			Depts = null;
		} }
		private int? _DeptID;

		/// <summary>
		/// 任务角色
		/// </summary>
		[JsonProperty]
		public int TaskRoleId { get; set; }


		/// <summary>
		/// 家庭地址
		/// </summary>
		[JsonProperty, Column(StringLength = 500)]
		public string Address { get; set; }

		/// <summary>
		/// 生日
		/// </summary>
		[JsonProperty]
		public DateTime? Birthday { get; set; }

		/// <summary>
		/// 单位电话
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string CellPhone { get; set; }

		/// <summary>
		/// 中文名
		/// </summary>
		[JsonProperty, Column(StringLength = 10)]
		public string ChineseName { get; set; }

		/// <summary>
		/// 单位邮箱
		/// </summary>
		[JsonProperty, Column(StringLength = 100)]
		public string CompanyEmail { get; set; }

		/// <summary>
		/// 创建时间
		/// </summary>
		[JsonProperty, Column(DbType = "varchar(20)")]
		public string CreateTime { get; set; }

		/// <summary>
		/// 创建人员
		/// </summary>
		[JsonProperty]
		public int? CreatorsId { get; set; }

		/// <summary>
		/// 邮箱
		/// </summary>
		[JsonProperty, Column(StringLength = 100)]
		public string Email { get; set; }

		/// <summary>
		/// 状态
		/// </summary>
		[JsonProperty]
		public bool Enabled { get; set; }

		/// <summary>
		/// 英文名
		/// </summary>
		[JsonProperty, Column(StringLength = 100)]
		public string EnglishName { get; set; }

		/// <summary>
		/// 性别
		/// </summary>
		[JsonProperty, Column(StringLength = 10)]
		public string Gender { get; set; }

		/// <summary>
		/// 家庭电话
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string HomePhone { get; set; }

		/// <summary>
		/// 工号
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string IdentityCard { get; set; }

		/// <summary>
		/// 上次登陆时间
		/// </summary>
		[JsonProperty]
		public DateTime? LastLoginTime { get; set; }

		/// <summary>
		/// 用户名
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string Name { get; set; }

		/// <summary>
		/// 办公电话
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string OfficePhone { get; set; }

		/// <summary>
		/// 办公地址
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string OfficePhoneExt { get; set; }

		/// <summary>
		/// 密码
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string Password { get; set; }

		/// <summary>
		/// 照片
		/// </summary>
		[JsonProperty, Column(StringLength = 200)]
		public string Photo { get; set; }

		/// <summary>
		/// QQ
		/// </summary>
		[JsonProperty, Column(StringLength = 50)]
		public string QQ { get; set; }

		/// <summary>
		/// 备注
		/// </summary>
		[JsonProperty, Column(StringLength = 500)]
		public string Remark { get; set; }

		/// <summary>
		/// 下次登陆是否重置密码
		/// </summary>
		[JsonProperty]
		public bool? ResetPassword { get; set; }

		/// <summary>
		/// 修改人员
		/// </summary>
		[JsonProperty]
		public int? RevisePersonnelId { get; set; }

		/// <summary>
		/// 修改时间
		/// </summary>
		[JsonProperty, Column(DbType = "varchar(20)")]
		public string ReviseTime { get; set; }

		/// <summary>
		/// 入职日期
		/// </summary>
		[JsonProperty]
		public DateTime? TakeOfficeTime { get; set; }


		#region 外键 => 导航属性，ManyToOne/OneToOne

		[Navigate("DeptID"), JsonProperty]
		public virtual Depts Depts { get; set; }

		[Navigate("TaskRoleId"), JsonProperty]
		public virtual TypeEnum TaskRole { get; set; }

		#endregion

		#region 外键 => 导航属性，OneToMany

		[Navigate("UserID")]
		public virtual List<Onlines> Onliness { get; set; }


		#endregion
	}

}
